/**
 * @ClassName LC3099
 * @Author ykx
 * @Date 2024/7/3 19:52
 * @Version 1.0
 */
public class LC3099 {
    public static void main(String[] args) {

    }

    public int sumOfTheDigitsOfHarshadNumber(int x) {
        int result = 0;
        String s = x + "";
        for (int i = 0; i < s.length(); i++) {
            result += s.charAt(i) - '0';
        }

        return x % result == 0 ? result : -1;
    }

}
